package wjw.mapper;

import com.wjw.mapper.RatingJudgeTableMapper;
import com.wjw.model.Evaluate_grade_table;
import com.wjw.model.Evaluate_index_table;
import com.wjw.model.Rating_judge_table;
import com.wjw.model.Roadway_type_table;
import com.wjw.utils.GetSqlSessionUtils;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

public class RatingJudgeTable {

    private SqlSession sqlsession= GetSqlSessionUtils.getSqlSession();
    private RatingJudgeTableMapper mapper=sqlsession.getMapper(RatingJudgeTableMapper.class);

    @Test
    public void test01(){
        List<Rating_judge_table> all = mapper.findAll();
        System.out.println(all);
    }

    @Test
    public void test02(){
        Rating_judge_table rating_judge_table = new Rating_judge_table();
        rating_judge_table.setEvaluate_grade_id(2);
        rating_judge_table.setEvaluate_index_id(2);
        rating_judge_table.setRating_judge_max(30);
        rating_judge_table.setRating_judge_min(13.24);
        rating_judge_table.setRoadway_type_id(1);
        mapper.add(rating_judge_table);
        sqlsession.commit();
    }

    @Test
    public void test03(){
        Rating_judge_table rating_judge_table = new Rating_judge_table();
        rating_judge_table.setEvaluate_grade_id(2);
        rating_judge_table.setEvaluate_index_id(2);
        rating_judge_table.setRating_judge_max(1);
        rating_judge_table.setRating_judge_min(1);
        rating_judge_table.setRoadway_type_id(1);
        rating_judge_table.setRating_judge_id(3);
        mapper.change(rating_judge_table);
        sqlsession.commit();
    }

    @Test
    public void test04(){
        Evaluate_grade_table gradeById = mapper.findGradeById(1);
        System.out.println(gradeById);
    }

    @Test
    public void test05(){
        Roadway_type_table aa = mapper.findRoadwayByName("测试");
        System.out.println(aa);

    }

}
